package com.liu.java_8_api;

import java.time.LocalDate;
import java.time.Period;

/**
 * @author LIU
 * @version 1.0
 * @description jdk8 日期时间类API
 * @date 2024/4/16 14:10
 */
public class DateApi {

    public static void main(String[] args) {
        period();

    }


    /**
     * 计算时间偏差
     */
    public static void period(){
        LocalDate now = LocalDate.now();
        LocalDate local1 = LocalDate.of(2024, 11, 11);
        LocalDate local2 = LocalDate.of(2025, 12, 12);
        Period period = Period.between(local1, local2);

        System.out.println(period.getYears());
        System.out.println(period.getMonths());
        System.out.println(period.getDays());
    }
}
